﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using nERP.Model;
using nERP.Model.Po;
using nERP.Model.Bas;
using nERP.Model.Wms;

namespace nERP.Model.Po
{
    /// <summary>
    /// 采购退货明细
    /// </summary>
	[Table("BuyReturnDetail")]
    [SoftKey(nameof(BuyReturnDetail.BuyReturnDetailCode))]
    [Display(Name = "_Model.BuyReturnDetail")]
    public class BuyReturnDetail : BasePoco, ITenant
    {
        [Display(Name = "_Model._BuyReturnDetail._Seq")]
        [Comment("序号")]
        public int? Seq { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyReturn")]
        [Comment("采购退货")]
        [NotMapped]
        public BuyReturn BuyReturn { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyReturn")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("采购退货")]
        public string BuyReturnId { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyReturnDetailCode")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("采购退货明细单号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string BuyReturnDetailCode { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyInWarehouseDetail")]
        [Comment("采购入库明细")]
        [NotMapped]
        public BuyInWarehouseDetail BuyInWarehouseDetail { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyInWarehouseDetail")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("采购入库明细")]
        public string BuyInWarehouseDetailId { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._Buy")]
        [Comment("采购")]
        [NotMapped]
        public Buy Buy { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._Buy")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("采购")]
        public string BuyId { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._Goods")]
        [Comment("商品")]
        [NotMapped]
        public Goods Goods { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._Goods")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("商品")]
        public string GoodsId { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._GoodsName")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品名称")]
        public string GoodsName { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._GoodsSpec")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品规格")]
        public string GoodsSpec { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._GoodsUnit")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品单位")]
        public string GoodsUnit { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._ReturnNumber")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("退货数量")]
        public decimal? ReturnNumber { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._UnitPrice")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("退货单价")]
        public decimal? UnitPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._DiscountPrice")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("折扣金额")]
        public decimal? DiscountPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._TotalPrice")]
        [Comment("退货金额")]
        public decimal? TotalPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._TaxRate")]
        [Comment("税率")]
        public decimal? TaxRate { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._TaxUnitPrice")]
        [Comment("含税单价")]
        public decimal? TaxUnitPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._TaxPrice")]
        [Comment("税额")]
        public decimal? TaxPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._TotalTaxPrice")]
        [Comment("含税金额")]
        public decimal? TotalTaxPrice { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._Status")]
        [Comment("状态")]
        public dStatusTypeEnum? Status { get; set; } = dStatusTypeEnum.Unaudited;
        [Display(Name = "_Model._BuyReturnDetail._Remark")]
        [StringLength(256, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyDatail")]
        [Comment("采购明细")]
        [NotMapped]
        public BuyDetail BuyDatail { get; set; }
        [Display(Name = "_Model._BuyReturnDetail._BuyDatail")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("采购明细")]
        public string BuyDatailId { get; set; }
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

    }

}
